package cn.crce.cloud9.comp;

import javax.swing.*;
import java.applet.Applet;
import java.awt.*;

/**
 * @author OnCloud9
 * @description
 * @project NRCE-TEST
 * @date 2022年09月13日 下午 09:25
 */
public class Case33 extends JApplet {
    JTextArea outputArea;

    public void init() {
        outputArea = new JTextArea();
//*********Found**********
        Container c = getContentPane();
//*********Found**********
        c.add(outputArea);
        //计算0至10的阶乘
        for (long i = 0; i <= 10; i++)
            outputArea.append(
                    i + "! = " + factorial(i) + "\n");
    }

    //阶乘的递归定义
    public long factorial(long number) {
        if (number <= 1)
            return 1;
        else
            return number * factorial(number - 1);
    }
}
